package com.tanhua.sso.server.service;

import com.tanhua.api.UserService;
import com.tanhua.config.UserHolder;
import com.tanhua.sso.pojo.User;
import com.tanhua.sso.vo.HuanXinUserVo;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

@Service
public class HuanXinService {

    @DubboReference
    private UserService userService;


    //返回环信用户信息
    public HuanXinUserVo huanUser() {
        //获取当前用户id
        Long userId = UserHolder.getUserId();
        User user = userService.findById(userId);
        HuanXinUserVo huanXinUserVo =new HuanXinUserVo();
        huanXinUserVo.setUsername(user.getHxUser());
        huanXinUserVo.setPassword(user.getHxPassword());
        return huanXinUserVo;
    }
}
